<template>
  <fieldset>
    <legend>子组件</legend>
    <h1>{{ gift }}</h1>
    <button @click="handleClick">点击传给父组件</button>
  </fieldset>
</template>
<script>
export default {
  data() {
    return {
      msg: "子组件属性",
      toParent: "脑黄金",
    };
  },
  props: ["gift"],
  methods: {
    handleClick() {
      this.$emit("receive", this.toParent);
    },
  },
  mounted() {
    this.$bus.$on("getBro", (i) => {
      console.log(i);
    });
  },
};
</script>
